home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Devices and Hardware / ATA / ATA Demo / ATA_powerpc.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  1.8 KB  |  54 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        ATA_powerpc.h
  3.     
  4.     Description:Macintosh ATA Manager Sample 
  5.  
  6.     Author:        BB
  7.  
  8.     Copyright:     Copyright: © 1999 by Apple Computer, Inc.
  9.                 all rights reserved.
  10.     
  11.     Disclaimer:    You may incorporate this sample code into your applications without
  12.                 restriction, though the sample code has been provided "AS IS" and the
  13.                 responsibility for its operation is 100% yours.  However, what you are
  14.                 not permitted to do is to redistribute the source as "DSC Sample Code"
  15.                 after having made changes. If you're going to re-distribute the source,
  16.                 we require that you make it clear in the source that the code was
  17.                 descended from Apple Sample Code, but that you've made changes.
  18.     
  19.     Change History (most recent first):
  20.                 6/23/99    Updated for Metrowerks Codewarrior Pro 2.1(KG)
  21.  
  22. */
  23.  
  24. /*/*************************************************************************
  25. ** This definition is only used if you are generating CFM.  In those cases,
  26. ** the "ataManager" call isn't defined.  See technote 1098 for details.
  27. **************************************************************************/
  28.  
  29. #if GENERATINGCFM
  30.  pascal SInt16 ataManager(ataPB *pb);
  31.  
  32. #define RESULT_OFFSET(type) \
  33.      ((sizeof(type) == 1) ? 3 : ((sizeof(type) == 2) ? 1 : 0))
  34.  #define TBTrapTableAddress(trapNum) (((trapNum & 0x03FF) << 2) + 0xE00)
  35.  
  36.  pascal SInt16 ataManager(ataPB *pb)
  37.  {
  38.      #ifdef applec
  39.          #if sizeof(SInt16) > 4
  40.              #error "Result types larger than 4 bytes are not supported."
  41.          #endif
  42.      #endif
  43.      long    private_result;
  44.  
  45.      private_result = CallUniversalProc(
  46.          *(UniversalProcPtr*)TBTrapTableAddress(0xAAF1),
  47.          kPascalStackBased
  48.           | RESULT_SIZE(SIZE_CODE(sizeof(SInt16)))
  49.           | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(pb))),
  50.          pb);
  51.      return *(((SInt16*)&private_result) + RESULT_OFFSET(SInt16));
  52.  }
  53. #endif 
  54.